package com.huaixia.cozeapi.response;

public enum ResponseCode implements ResponseCodeInterface {

	SUCCESS(200, "成功"),
	ERROR(400, "系统异常"),
	;
	private int code;
	private String msg;

	ResponseCode(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public static ResponseCode valueOf(int code) {
		ResponseCode result = null;
		ResponseCode[] ts = ResponseCode.class.getEnumConstants();
		for (ResponseCode aps : ts) {
			if (aps.getCode() == code) {
				result = aps;
				break;
			}
		}
		return result;
	}

	@Override
    public int getCode() {
		return this.code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	@Override
    public String getMsg() {
		return this.msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	@Override
	public String toString() {
		return "ResponseCode{" +
				"Code=" + code +
				", msg='" + msg + '\'' +
				'}';
	}
}